Modern object-oriented programs make heavy and extensive use of the heap. The causes of many program errors can be detected early if the developer is given the opportunity to check heap related assertions at specific program points. Unfortunately, while checking heap invariants during program execution can be useful, it can also be very expensive and can cause significant slowdowns. The problem is that the program execution must be stopped while the heap assertion is being checked.
Assertions are a powerful technique for program monitoring and bug detection. Traditional general purpose assertion checking, however, is currently considered too expensive to be of practical use. Indeed, as assertion checking is performed synchronously, regardless of how well one optimizes their assertion checking code, it fundamentally imposes its full cost on the runtime of the program. In turn, this makes the process of writing assertion checks inherently burdensome and impractical as the programmer is now forced to continually estimate and limit the complexity and frequency of their assertion checks in order to avoid extreme slowdowns.
In this work, we propose asynchronous assertions. Asynchronous assertions allow program execution and assertion checking to proceed simultaneously: the program no longer needs to be stopped while the assertion is being evaluated. Furthermore, the semantics of a concurrently checked assertion may be the same as if the assertion were evaluated sequentially.